import request from '@/utils/request';
import { getUserInfo } from "@/utils/auth";

// 组织架构
export function getSysStructsTreeApi() {
  return request({
    url: process.env.VUE_APP_SYS_SERVICE + 'api/sysStruct/getSysStructsTree',
    method: 'get'
  });
}

export function getRoleListApi(postBody) {
  postBody.userId = getUserInfo().userId;
  return request({
    url: process.env.VUE_APP_SYS_SERVICE + 'api/sysRole/getSysRoleListByPage',
    method: 'post',
    data: postBody,
    disableLoading: true // 提示作用，以后默认为true
  });
}

// 查询字典
export function getDictionaryDataListApi(postBody) {
  postBody.userId = getUserInfo().userId;
  return request({
    url: process.env.VUE_APP_SYS_SERVICE + 'api/sysEnumDictionary/getSysEnumDictionaryListByPage',
    method: 'post',
    data: postBody
  });
}

// 获取用户列表
export function getUserListApi(postBody) {
  return request({
    url: process.env.VUE_APP_SYS_SERVICE + 'api/sysUser/getSysUserListByPage',
    method: 'post',
    data: postBody
  });
}

// 删除选中用户数据
export function deleteUserApi(ids) {
  return request({
    url: process.env.VUE_APP_SYS_SERVICE + 'api/sysUser/deleteByList',
    method: 'post',
    data: {
      userId: getUserInfo().userId,
      keyValues: ids
    }
  });
}

// 重置密码
export function resetPasswordApi(id) {
  return request({
    url: process.env.VUE_APP_SYS_SERVICE + 'account/resetPassword',
    method: 'post',
    data: {
      objectId: id
    }
  });
}